<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateWechatMaterialTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('wechat_material', [
            'comment' => '素材管理', 
            'engine' => 'InnoDB', 
            'collation' => 'utf8mb4_general_ci'
        ]);
        $table->addColumn(Column::enum('type', ['text', 'link'])->setComment('类型:text=文字,link=链接'))
            ->addColumn('content', 'string', ['limit'  =>  2500, 'comment' => '内容'])
            ->addColumn('create_time', 'integer', ['limit'  =>  10, 'null' => true, 'default' => null, 'comment' => '创建时间'])
            ->addColumn('update_time', 'integer', ['limit'  => 10, 'null' => true, 'default' => null, 'comment' => '更新时间'])
            ->addColumn('delete_time', 'integer', ['limit'  =>  10, 'null' => true, 'default' => null, 'comment' => '删除时间'])
            ->create();
    }


    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('wechat_material');
        $table->drop();
    }
}
